package com.zmj.sy.mom.srv.aps.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zmj.sy.mom.srv.aps.bean.entity.order.OrderPhase;
import com.zmj.sy.mom.srv.aps.bean.entity.resource.Group;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderPhaseMapper extends SyMapper<OrderPhase> {

    @Select("select distinct work_group_number from tb_order_phase")
    List<String> selectGroupList(QueryWrapper<OrderPhase> query);

    List<Group> selectByMyCodeList(LambdaQueryWrapper<Group> query);

    @Select("delete from tb_order_phase where order_id = #{orderId}")
    void deleteReal(@Param("orderId") Integer orderId);

    @Select("delete from tb_order_phase where bom_id = #{bomId}")
    void deleteByBomId(@Param("bomId") Integer bomId);

    @Select("delete from tb_order_phase where id = #{id}")
    void deleteRealById(@Param("id") Integer id);

    @Select("select * from tb_order_phase ${ew.customSqlSegment}")
    List<OrderPhase> listByQuery(@Param(Constants.WRAPPER) QueryWrapper<?> query);
}
